/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package padroes_3;

import java.util.Random;

/**
 *
 * @author Delvoux
 */
public class FactoryConta implements FactoryContaIF{

    public static FactoryContaIF instanciaUnica = null;

    public static FactoryContaIF getInstancia(String tipo){
        if(tipo.equals("ContaCorrente"))
            return new FactoryContaCorrente();
        else if(tipo.equals("ContaPoupanca"))
            return new FactoryContaPoupanca();
        else{
            if(instanciaUnica == null) instanciaUnica = new FactoryConta();
            return instanciaUnica;
        }
    }

    public Conta criaConta(){
        return new Conta();
    }

    public Cliente criaCliente() {
        return new Cliente();
    }

    public Agencia criaAgencia() {
        return new Agencia();
    }
}
